package com.feilong.edgeAI.remind.room.ui;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.feilong.edgeAI.R;
import com.feilong.edgeAI.remind.alarm.AlarmClockHelper;
import com.feilong.edgeAI.remind.room.adapter.RemindListAdapter;
import com.feilong.edgeAI.remind.room.bean.RemindBean;
import com.feilong.edgeAI.remind.room.db.RemindDatabase;

import java.util.List;


public class InquiryDialog extends BaseDialog implements View.OnClickListener , Observer {

    private RemindBean remindBean;
    private OnRefreshDataListener mListener;
    private RecyclerView recyclerView ;
    private String strFlag = "0";

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_remind_info;
    }

    @Override
    protected void initView(View view) {

        recyclerView = view.findViewById(R.id.remind_recycleview);


    }

    @Override
    protected void loadData(Bundle bundle) {
        recyclerView.setLayoutManager(new GridLayoutManager(getActivity().getApplicationContext(), 1));
        if (bundle != null) {
            remindBean = bundle.getParcelable("RemindBean");
            strFlag = bundle.getString("flag");
            Log.i("AAAA", "loadData: "+ strFlag);
        }
        List<RemindBean> remindBeans = RemindDatabase.getDefault(getActivity().getApplicationContext()).getRemindDao().loadRemindByDays(strFlag);
        RemindListAdapter mAdapter = new RemindListAdapter(remindBeans);
        recyclerView.setAdapter(mAdapter);
    }




    public void setOnRefreshDataListener(OnRefreshDataListener listener) {
        this.mListener = listener;
    }

    @Override
    public void onChanged(Object o) {

    }

    @Override
    public void onClick(View view) {

    }

    public interface OnRefreshDataListener {
        void onRefresh();
    }
}
